package com.example.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope //配置动态刷新
public class ConfigClientController {
    //配置中心yml文件中有config.info相关信息 "branch master, ...."
    @Value("${config.info}")
    private String configInfo;

    @Value("${server.port}")
    private String port;

    @GetMapping("/config-info")
    public String getConfigInfo() {
        return "port: " + port + "\t" + configInfo;
    }
}
